<div id="content">
	<div class="row s_page_title">
		<sa-big-breadcrumbs [items]="['项目管理','小程序管理[随你运]','权限管理']" icon="fa fa-smile-o" class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
	</div>
	<sa-widgets-grid>
		<div class="s_table">
			<div sa-widget [editbutton]="false" color="darken" class="clearfix">
				<header><span class="widget-icon"> <i class="fa fa-table"></i> </span><h2>权限管理</h2></header>
				<div>
					<div class="widget-body no-padding">
						<div class="page-header clearfix s_table_opreation">
							<div class="left page-header-btn">
								<div class="top_module">
									<span class="module_text">公司名称</span>
									<sa-company-tree companyTreeId="companyTree" (companySelected)="companySelected($event)"></sa-company-tree>
								</div>
								<div class="top_module top_module_box">
									<span class="module_text">方案名称</span>
									<input type="text" class="module_inp top_module_select" [(ngModel)]="tableParam.name" placeholder="方案名称"/>
								</div>
								<!-- <div class="top_module top_module_box">
										<span class="top_module_label module_text">生效状态</span>
										<select name="" class="top_module_select" [(ngModel)]="tableParam.status">
												<option value="">全部</option>
												<option value="1">已生效</option>
												<option value="0">未生效</option>
										</select>
								</div>
								<div class="top_module top_module_box">
									<span class="top_module_label module_text">时间类型</span>
									<select name="" class="top_module_select" [(ngModel)]="tableParam.dateType">
										<option value="">全部</option>
										<option value="1">创建时间</option>
										<option value="2">更新时间</option>
									</select>
								</div>
								<div class="top_module top_module_box">
									<span class="top_module_label module_text">排序</span>
									<select name="" class="top_module_select" [(ngModel)]="tableParam.sortType">
										<option value="2">升序</option>
										<option value="1">降序</option>
									</select>
								</div> -->
								<!--<div class="selectDate top_module">
									<table-select-date [notInit]='true' (outerTime)="getSelectTableTime($event)"  [specifyTime]='initDateRange' [minDay]='true'></table-select-date>
								</div>-->
								<button type="button" class="btn btn-primary" (click)="table_search()">查询</button>
								<button type="button" class="btn btn-primary" (click)="showAddUserModal(solutionConfigModal)" *ngIf="isShowAdd">添加</button>
							</div>
							<!--<div class="right top-search">
								<input type="text" [(ngModel)]="tableParam.searchKey" (change)="table_search()" class="search-input" placeholder="项目名称、原因分析">
								<span class="top-search-box">
							    <button class="top-search-btn" type="button" (click)="table_search()"> <i class="fa fa-search"></i></button>
							  </span>
							</div>-->
						</div>
						<div class="table_scroll">
							<table class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
								<thead>
									<tr>
										<th>方案名称</th>
										<th>适用范围</th>
										<th>方案配置</th>
										<th>生效状态</th>
										<th>创建人</th>
										<th>创建时间</th>
										<th>更新人</th>
										<th>更新时间</th>
										<th *ngIf="isShowDel || isShowEdit">操作</th>
									</tr>
								</thead>
								<tbody>
									<tr *ngFor="let row of tableData" >
										<td>{{row.name}}</td>
										<td>
											<button type="button" (click)="viewRange(row,viewRangeModal)">查看范围</button>
										</td>
										<td>
										  <button type="button" (click)="viewRow(row,projectEventModal1,'detail')">方案详细</button>
										</td>
										<td  *ngIf="isShowEdit" class="smart-form" style="padding: 7px 10px;">
											<input style="margin-right: 5px;display: none;" name="status" class="isEnable" type="checkbox" [checked]="row.status" [id]='row.id'>
										</td>
										<td *ngIf="!isShowEdit" class="smart-form" style="height:28px;line-height:28px;text-align: center;">
											<div class="mySwitch" *ngIf="row.status == '0'"><span class="white"></span><span class="closeText">关闭</span></div>
											<div class="mySwitch" *ngIf="row.status == '1'"><span  class="openText">开启</span><span class="white"></span></div>
										</td>
										<td>{{row.createUser}}</td>
										<td>{{row.createTime}}</td>
										<td>{{row.updateUser}}</td>
										<td>{{row.updateTime}}</td>
										<td *ngIf="isShowDel || isShowEdit">
											<button *ngIf="isShowEdit" type="button" (click)="editRow(row,solutionConfigModal,'update')">编辑</button>
											<button *ngIf="isShowDel" type="button" (click)="delRow(row)">删除</button>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
						<div class="table-fix clearfix">
							<paginator [totalRecords]="totalCount"
						    [rows]="pageSize"
						    [currentPage]="curPage - 1"
						    (onPageChange)="paginate($event)">
							</paginator>
							<button type="button" class="btn default refresh_btn" (click)="refresh()"><i class="fa fa-refresh"></i></button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</sa-widgets-grid>
</div>

<!-- 新增方案   弹窗-->
<section bsModal #solutionConfigModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
	<div class="modal-dialog modal-lg" style="width: 860px;">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" (click)="closeSolutionConfigModal(solutionConfigModal)" aria-label="Close"><span aria-hidden="true">&times;</span></button>     
				<h4 class="modal-title"><span *ngIf="formType == 'add'">新增</span><span *ngIf="formType == 'update'">编辑</span>方案</h4>
			</div>
			<form id="projectEventForm"  class="form-horizontal" role="form" novalidate="novalidate" [saBootstrapValidator]="validatorOptions">
				<div class="modal-body">
					<div class="row form-horizontal">
						<div class="form-group col-xs-12">
							<label class="control-label col-xs-2">方案名称<sup>*</sup></label>
							<div class="col-xs-10" >
								<input class="form-control" name="name"  [(ngModel)]='contractForm.name' placeholder="方案名称"/>
							</div>
						</div>
						<div class="form-group col-xs-12">
							<label class="control-label col-xs-2">适用范围<sup>*</sup></label>
							<div class="col-xs-10">
							  <sa-company-tree-checkbox wrap="html" companyTreeId="companyTreeFrom" [Height]="32" [companyValue]="contractForm.appletResourceCompanyList" (companySelected)="addCompanySelected($event)"></sa-company-tree-checkbox>
							</div>
						</div>
						<div class="form-group col-xs-12" style="border-bottom: 1px solid #ddd;">
							<label class="control-label col-xs-2">生效状态</label>
							<div class="col-xs-6" >
								<td class="smart-form" style="padding: 7px 10px;text-align: center;">
									<input  style="margin-right: 5px;display: none;" name="status" class="isStatus" type="checkbox" [checked]="contractForm.status"/>
								</td>
							</div>
						</div>
						<div class="form-group col-xs-12">
							<label class="control-label col-xs-2">方案配置</label>
							<div class="table_scroll" style="max-height: 400px;">
								<table	class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
									<thead>
										<tr>
											<th>资源名称</th>
											<th>启用状态</th>
											<th>上级名称</th>
											<th>资源标识</th>
											<th>资源类型</th>
										</tr>
									</thead>
									<tbody>
										<tr *ngFor="let row of solutionConfigData; let i = index" [attr.data-index]="i">
											<td>{{row.name}}</td>
											<td class="smart-form" style="padding: 7px 10px;">
												<input style="margin-right: 5px;display: none;" name="isHide" class="isHide" type="checkbox" [checked]="row.isHide" [id]='row.id'>
											</td>
											<td>{{row.parentName}}</td>
											<td>{{row.sourceKey}}</td>
											<td>
												<span *ngIf="row.type == 0" class="green">菜单</span>
												<span *ngIf="row.type == 1" class="orange">按钮</span>
												<span *ngIf="row.type == 2" class="blue">字段</span>
											</td>
										</tr>
									</tbody>
								</table>
							</div>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" (click)="closeSolutionConfigModal(solutionConfigModal)">取消</button>
					<button type="button" class="btn btn-primary" (click)="solutionConfigSubmit(solutionConfigModal)">确认</button>
				</div>
			</form>
		</div>


	</div>
</section>
<!-- 新增方案 弹窗end-->

<!-- 方案查看   弹窗-->
<section bsModal #projectEventModal1="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg" style="width: 860px;">
        <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" (click)="closeProjectEventModal(projectEventModal1)" aria-label="Close"><span aria-hidden="true">&times;</span></button>     
              <h4 class="modal-title">查看配置</h4>
            </div>
            <form  class="form-horizontal" role="form" novalidate="novalidate">
							<div class="modal-body">
								<div class="row form-horizontal">
									<div class="form-group col-xs-12">
										<label class="control-label col-xs-2">方案名称<sup>*</sup></label>
										<div class="col-xs-10" >
											<input class="form-control" name="name"  [(ngModel)]='contractForm.name' placeholder="方案名称" disabled/>
										</div>
									</div>
									<div class="form-group col-xs-12">
										<label class="control-label col-xs-2">适用范围<sup>*</sup></label>
										<div class="col-xs-10">
											<input class="form-control" name="companyNames" [(ngModel)]='contractForm.companyName' disabled [attr.title]="contractForm.companyName"/>
										</div>
									</div>
									<div class="form-group col-xs-12">
										<label class="control-label col-xs-2">生效状态</label>
										<div class="col-xs-6" >
											<td class="smart-form" style="height:28px;line-height:28px;text-align: center;">
												<div class="mySwitch" *ngIf="contractForm.status == '0'"><span class="white"></span><span class="closeText">关闭</span></div>
												<div class="mySwitch" *ngIf="contractForm.status == '1'"><span  class="openText">开启</span><span class="white"></span></div>
											</td>
										</div>
									</div>
									<div class="form-group col-xs-12">
										<label class="control-label col-xs-2">方案配置</label>
										<div class="col-xs-10" >
											<div class="table_scroll" style="max-height: 400px;">
												<table	class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
													<thead>
														<tr>
															<th>资源名称</th>
															<th>启用状态</th>
															<th>上级名称</th>
															<th>资源标识</th>
															<th>资源类型</th>
														</tr>
													</thead>
													<tbody>
														<tr *ngFor="let row of this.contractForm.resourceList; let i = index" [attr.data-index]="i">
															<td>{{row.name}}</td>
															<td class="smart-form" style="height:28px;line-height:28px;text-align: center;">
																<div class="mySwitch" *ngIf="row.isHide == '0'"><span class="white"></span><span class="closeText">关闭</span></div>
																<div class="mySwitch" *ngIf="row.isHide == '1'"><span  class="openText">开启</span><span class="white"></span></div>
															</td>
															<td>{{row.parentName}}</td>
															<td>{{row.sourceKey}}</td>
															<td>
																<span *ngIf="row.type == 0" class="green">菜单</span>
																<span *ngIf="row.type == 1" class="orange">按钮</span>
																<span *ngIf="row.type == 2" class="blue">字段</span>
															</td>
														</tr>
													</tbody>
												</table>
											</div>
										</div>
									</div>
								</div>
							</div>
            </form>
        </div>
    </div>
</section>
<!-- 方案查看 弹窗end-->

<!-- 查看范围   弹窗-->
<section bsModal #viewRangeModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
	<div class="modal-dialog modal-lg" style="width: 700px;">
			<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" (click)="closeViewRangeModal(viewRangeModal)" aria-label="Close"><span aria-hidden="true">&times;</span></button>     
						<h4 class="modal-title">查看范围</h4>
					</div>
						<div class="modal-body">
							<div class="row form-horizontal">
								{{programme}}
								<!-- <div class="form-group col-xs-12">
									<label class="control-label col-xs-2">方案名称<sup>*</sup></label>
									<div class="col-xs-10" >
										<input class="form-control" name="name"  [(ngModel)]='contractForm.name' placeholder="方案名称" disabled/>
									</div>
								</div> -->
							</div>
						</div>
			</div>
	</div>
</section>
<!-- 查看范围 弹窗end-->
